package com.lwb.demo3.service;

import com.lwb.demo.entity.DemoEntity;
import com.lwb.demo3.dao.Demo3Dao;
import io.seata.core.context.RootContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class Demo3Service {
    @Resource
    Demo3Dao demo3Dao;

    public String execute(String id) {
        System.out.println("全局事务id ：" + RootContext.getXID());
        DemoEntity de = new DemoEntity();
        de.setId(id);
        de.setContext("id:" + id);
        demo3Dao.save(de);
        return id + " save success!";
    }
}
